﻿/******************************************
* 模块名称：实体 T_DEMO
* 当前版本：1.0
* 开发人员：楚涛
* 完成时间：2010-11-28
* 版本历史：此代码由 VB/C#.Net实体代码生成工具(EntitysCodeGenerate 4.2) 自动生成。
* 
******************************************/
using System;
using System.Data;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Xml;
using System.IO;
using System.Text;
using System.Database;
using System.Database.ORMap;
using System.Database.Extend;

namespace LXChuTao.ECG.Demo.Entity
{
	/// <summary>
	/// 实体 T_DEMO
	/// </summary>
	[Serializable(),Description("Primary:C_ID")]
	public class T_DEMO : BaseEntity
	{
        #region 构造函数
        /// <summary>
        /// 实体 T_DEMO
        /// </summary>
        public T_DEMO(){}
        /// <summary>
        /// 实体 T_DEMO
        /// </summary>
        /// <param name="keyValue">主键C_ID对应的值</param>
        public T_DEMO(object keyValue)
        {
            ListDictionary list = new ListDictionary();
            list.Add("C_ID", keyValue);
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
            ormap.GetEntity(list);
        }
        /// <summary>
        /// 实体 T_DEMO
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="colValue">实体字段名(colName)匹配相等的值</param>
        public T_DEMO(string colName, object colValue)
        {
            ListDictionary list = new ListDictionary();
            list.Add(colName, colValue);
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
            ormap.GetEntity(list);
        }
        /// <summary>
        /// 实体 T_DEMO
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="colValues">实体字段名数组(colNames)匹配相等的值</param>
        public T_DEMO(string[] colNames, object[] colValues)
        {
            if (colNames.Length == colValues.Length)
            {
                ListDictionary list = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    list.Add(colNames[i], colValues[i]);
                }
                ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
                ormap.GetEntity(list);
            }
        }
        /// <summary>
        /// 实体 T_DEMO
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="colName">实体字段名</param>
        /// <param name="colValue">实体字段名(colName)匹配相等的值</param>
        public T_DEMO(DbCore dbCore, string colName, object colValue)
        {
            ListDictionary list = new ListDictionary();
            list.Add(colName, colValue);
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
            ormap.GetEntity(dbCore, list);
        }
        /// <summary>
        /// 实体 T_DEMO
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="colValues">实体字段名数组(colNames)匹配相等的值</param>
        public T_DEMO(DbCore dbCore, string[] colNames, object[] colValues)
        {
            if (colNames.Length == colValues.Length)
            {
                ListDictionary list = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    list.Add(colNames[i], colValues[i]);
                }
                ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, this);
                ormap.GetEntity(dbCore, list);
            }
        }
        #endregion

        #region 私有变量
        private DateTime _c_date = DateTime.MinValue;
        private DateTime _c_eidtdate = DateTime.MinValue;
        private string _c_email = null;
        private float _c_float = float.MinValue;
        private float _c_floata = float.MinValue;
        private float _c_floatb = float.MinValue;
        private string _c_id = null;
        private string _c_idcard = null;
        private Int32 _c_int = Int32.MinValue;
        private Int32 _c_inta = Int32.MinValue;
        private Int32 _c_intb = Int32.MinValue;
        private string _c_name = null;
        private string _c_string = null;
        private string _c_stringa = null;
        private string _c_stringb = null;
        #endregion

        #region 公共属性
        /// <summary>
        /// 填写日期
        /// </summary>
        [DataObjectField(false)]
        public DateTime C_DATE
        {
            set{ _c_date=value;}
            get{return _c_date;}
        }
        /// <summary>
        /// 最后修改日期时间
        /// </summary>
        [DataObjectField(false)]
        public DateTime C_EIDTDATE
        {
            set{ _c_eidtdate=value;}
            get{return _c_eidtdate;}
        }
        /// <summary>
        /// 电子邮件
        /// </summary>
        [DataObjectField(false)]
        public string C_EMAIL
        {
            set{ _c_email=value;}
            get{return _c_email;}
        }
        /// <summary>
        /// 浮点数，可正可负
        /// </summary>
        [DataObjectField(false)]
        public float C_FLOAT
        {
            set{ _c_float=value;}
            get{return _c_float;}
        }
        /// <summary>
        /// 正浮点数
        /// </summary>
        [DataObjectField(false)]
        public float C_FLOATA
        {
            set{ _c_floata=value;}
            get{return _c_floata;}
        }
        /// <summary>
        /// 负浮点数
        /// </summary>
        [DataObjectField(false)]
        public float C_FLOATB
        {
            set{ _c_floatb=value;}
            get{return _c_floatb;}
        }
        /// <summary>
        /// 主键 序列号,格式：yyyyMMddHHmmssfff00000000
        /// </summary>
        [DataObjectField(true)]
        public string C_ID
        {
            set{ _c_id=value;}
            get{return _c_id;}
        }
        /// <summary>
        /// 身份证号
        /// </summary>
        [DataObjectField(false)]
        public string C_IDCARD
        {
            set{ _c_idcard=value;}
            get{return _c_idcard;}
        }
        /// <summary>
        /// 整数，可正可负
        /// </summary>
        [DataObjectField(false)]
        public Int32 C_INT
        {
            set{ _c_int=value;}
            get{return _c_int;}
        }
        /// <summary>
        /// 正整数
        /// </summary>
        [DataObjectField(false)]
        public Int32 C_INTA
        {
            set{ _c_inta=value;}
            get{return _c_inta;}
        }
        /// <summary>
        /// 负整数
        /// </summary>
        [DataObjectField(false)]
        public Int32 C_INTB
        {
            set{ _c_intb=value;}
            get{return _c_intb;}
        }
        /// <summary>
        /// 名称
        /// </summary>
        [DataObjectField(false)]
        public string C_NAME
        {
            set{ _c_name=value;}
            get{return _c_name;}
        }
        /// <summary>
        /// 字符串
        /// </summary>
        [DataObjectField(false)]
        public string C_STRING
        {
            set{ _c_string=value;}
            get{return _c_string;}
        }
        /// <summary>
        /// 字符串A
        /// </summary>
        [DataObjectField(false)]
        public string C_STRINGA
        {
            set{ _c_stringa=value;}
            get{return _c_stringa;}
        }
        /// <summary>
        /// 字符串B
        /// </summary>
        [DataObjectField(false)]
        public string C_STRINGB
        {
            set{ _c_stringb=value;}
            get{return _c_stringb;}
        }
        #endregion

        #region 常用 增、删、改、查 操作(注：.Net下数值型字段初始值默认为0;带?的数值型字段值默认为null.)

        #region public int DelInsert/DelInsertEx 扩展方法
        /// <summary>
        ///  先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.DelInsert(new T_DEMO());
        }
        /// <summary>
        /// 先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.DelInsertEx(new T_DEMO());
        }
        #endregion

        #region public int Insert 增加
        /// <summary>
        /// 通过实体映射插入表中一条数据，插入与初始值不同的字段
        /// </summary>
        /// <returns>执行插入数据并返回受影响的行数</returns>
        public int Insert()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.Insert(new T_DEMO());
        }
        #endregion

        #region public int Update 更新
        /// <summary>
        /// 通过实体映射及主键约束更新表中一条数据，并与比较实体初始值比较，若内容不同则更新之，否则不更新(并与实体默认初始值比较确定更新哪些字段,与默认初始值一样的字段将不更新)
        /// </summary>
        /// <returns>执行更新并返回受影响的行数</returns>
        public int Update()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.Update(new T_DEMO());
        }
        #endregion

        #region public T_DEMO GetEntity 获取实体信息
        /// <summary>
        /// 通过实体映射及主键值获取表中一条数据信息
        /// </summary>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public T_DEMO GetEntity()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new T_DEMO());
            return ormap.GetEntity() as T_DEMO;
        }
        /// <summary>
        /// 通过实体映射及主键值获取表中一条数据信息
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例</param>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public T_DEMO GetEntity(DbCore dbCore)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new T_DEMO());
            return ormap.GetEntity(dbCore) as T_DEMO;
        }
        /// <summary>
        /// 通过Hashtable键值实体条件获取表中一条数据信息
        /// </summary>
        /// <param name="hash">获取实体信息的条件值</param>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public T_DEMO GetEntity(Hashtable hash)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(new T_DEMO(), new T_DEMO());
            return ormap.GetEntity(hash) as T_DEMO;
        }
        /// <summary>
        /// 根据ListDictitionary键值实体条件值获取实体信息,通常包含 10 个或 10 个以下项的集合,建议这时使用
        /// </summary>
        /// <param name="list">获取实体信息的条件值</param>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条)，没有为null</returns>
        public T_DEMO GetEntity(ListDictionary list)
        {;
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(new T_DEMO(), new T_DEMO());
            return ormap.GetEntity(list) as T_DEMO;
        }
        #endregion

        #region public int Save 保存 规则：按主键判断有就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// <summary>
        /// 保存 比较实体前后的值，若有与主键记录相同的就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// </summary>
        /// <returns>执行更新或插入数据操作并返回受影响的行数</returns>
        public int Save()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this);
            return ormap.Save1(new T_DEMO());
        }
        #endregion

        #region public int SaveByEntityCondition 保存 规则：按当前实体唯一条件值判断有就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// <summary>
        /// 用于没有主键表的辅助方法，有主键表的建议使用Save()
        /// 保存 比较实体前后的值，若有与现在实体唯一记录相同的就更新，没有就插入，且不保存与实体初始值相同的字段值
        /// 前提条件当前实体字段所赋值必须唯一，否则获取记录为多条返回多条更新将会产生不正确的结果，更新多条记录等问题
        /// </summary>
        /// <param name="entityCondition">更新或插入的实体唯一条件</param>
        /// <returns>执行更新或插入数据操作并返回受影响的行数</returns>
        public int SaveByEntityCondition(T_DEMO entityCondition)
        {
            T_DEMO entity = new T_DEMO();
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, entity);
            return ormap.SaveByAny(entity, entityCondition);
        }
        #endregion

        #region public T_DEMO GetEntityByEntityCondition 通过实体值获取一条实体信息
        /// <summary>
        /// 用于没有主键表的辅助方法，有主键表的建议使用GetEntity()
        /// 通过实体信息并与实体初始值的比较，凡与初始值比较不同的值作为实体的获取条件，返回相应的一条实体信息
        /// </summary>
        /// <returns>返回类型为 Entity 单条实体信息(若符合条件的记录多条，则返回第一条),没有返回为null</returns>
        public T_DEMO GetEntityByEntityCondition()
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new T_DEMO());
            return ormap.GetEntityByAny() as T_DEMO;
        }
        #endregion

        #endregion

        #region public T_DEMO FromXml 相关Xml操作
        /// <summary>
        /// 通过与持久化实体信息相对应Xml格式的文本信息实例化到该实体信息
        /// </summary>
        /// <param name="xmlString">与持久化实体信息相对应Xml格式的文本信息</param>
        /// <returns>返回对应的实体信息</returns>
        public T_DEMO FromXml(string xmlString)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new T_DEMO());
            return ormap.FromXml(xmlString) as T_DEMO;
        }
        /// <summary>
        /// 通过与持久化实体信息相对应Xml格式的文本信息实例化到该实体信息
        /// </summary>
        /// <param name="filename">文件的 URL，该文件包含要加载的 XML 文档。URL 既可以是本地文件，也可以是 HTTP URL（Web 地址）。</param>
        /// <returns>实例化该实体信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public T_DEMO FromXmlFile(string filename)
        {
            ORMap<BaseEntity> ormap = new ORMap<BaseEntity>(this, new T_DEMO());
            return ormap.FromXmlFile(filename) as T_DEMO;
        }
        #endregion

        #region 公共静态只读属性
        /// <summary>
        /// 表名 表原信息描述: T_DEMO
        /// </summary>
        public static readonly string s_TableName="T_DEMO";
        /// <summary>
        /// 信息描述: 填写日期
        /// </summary>
        public static readonly string s_C_DATE="T_DEMO┋C_DATE┋System.DateTime";
        /// <summary>
        /// 信息描述: 最后修改日期时间
        /// </summary>
        public static readonly string s_C_EIDTDATE="T_DEMO┋C_EIDTDATE┋System.DateTime";
        /// <summary>
        /// 信息描述: 电子邮件
        /// </summary>
        public static readonly string s_C_EMAIL="T_DEMO┋C_EMAIL┋System.String";
        /// <summary>
        /// 信息描述: 浮点数，可正可负
        /// </summary>
        public static readonly string s_C_FLOAT="T_DEMO┋C_FLOAT┋System.Single";
        /// <summary>
        /// 信息描述: 正浮点数
        /// </summary>
        public static readonly string s_C_FLOATA="T_DEMO┋C_FLOATA┋System.Single";
        /// <summary>
        /// 信息描述: 负浮点数
        /// </summary>
        public static readonly string s_C_FLOATB="T_DEMO┋C_FLOATB┋System.Single";
        /// <summary>
        /// 信息描述: 序列号,格式：yyyyMMddHHmmssfff00000000
        /// </summary>
        public static readonly string s_C_ID="T_DEMO┋C_ID┋System.String";
        /// <summary>
        /// 信息描述: 身份证号
        /// </summary>
        public static readonly string s_C_IDCARD="T_DEMO┋C_IDCARD┋System.String";
        /// <summary>
        /// 信息描述: 整数，可正可负
        /// </summary>
        public static readonly string s_C_INT="T_DEMO┋C_INT┋System.Int32";
        /// <summary>
        /// 信息描述: 正整数
        /// </summary>
        public static readonly string s_C_INTA="T_DEMO┋C_INTA┋System.Int32";
        /// <summary>
        /// 信息描述: 负整数
        /// </summary>
        public static readonly string s_C_INTB="T_DEMO┋C_INTB┋System.Int32";
        /// <summary>
        /// 信息描述: 名称
        /// </summary>
        public static readonly string s_C_NAME="T_DEMO┋C_NAME┋System.String";
        /// <summary>
        /// 信息描述: 字符串
        /// </summary>
        public static readonly string s_C_STRING="T_DEMO┋C_STRING┋System.String";
        /// <summary>
        /// 信息描述: 字符串A
        /// </summary>
        public static readonly string s_C_STRINGA="T_DEMO┋C_STRINGA┋System.String";
        /// <summary>
        /// 信息描述: 字符串B
        /// </summary>
        public static readonly string s_C_STRINGB="T_DEMO┋C_STRINGB┋System.String";
        #endregion
	}

    /// <summary>
    /// T_DEMO实体集
    /// </summary>
    [Serializable]
    public class T_DEMOS : CollectionBase
    {
        #region 构造函数
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        public T_DEMOS(){}
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="blnRetrieveData">是否获取所有数据到实体集对象的标示(true获取所有实例信息,false仅实例化对象)</param>
        public T_DEMOS(bool blnRetrieveData)
        {
            if (blnRetrieveData)
            {
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(new ListDictionary());
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="blnRetrieveData">是否获取所有数据到实体集对象的标示(true获取所有实例信息,false及实例化对象)</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(bool blnRetrieveData, string[] orderColumns, OrderDirection[] orderDirections)
        {
            if (blnRetrieveData)
            {
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(new ListDictionary(), new Operation[] { }, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="colValue">实体字段名匹配相等的值</param>
        public T_DEMOS(string colName,object colValue)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(),this);
            ormaps.GetEntitys(listColAndValue);
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="operate">比较操作符</param>
        /// <param name="colValue">实体字段名对应的值</param>
        public T_DEMOS(string colName, Operation operate,object colValue)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(),this);
            ormaps.GetEntitys(listColAndValue, operate);
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="operate">比较操作符</param>
        /// <param name="colValue">实体字段名对应的值</param>
        /// <param name="orderColumn">排序字段</param>
        /// <param name="orderDirection">对应排序方向</param>
        public T_DEMOS(string colName, Operation operate, object colValue, string orderColumn, OrderDirection orderDirection)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            ormaps.GetEntitys(listColAndValue, new Operation[] { operate }, new string[] { orderColumn }, new OrderDirection[] { orderDirection });
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colName">实体字段名</param>
        /// <param name="operate">比较操作符</param>
        /// <param name="colValue">实体字段名对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(string colName, Operation operate, object colValue, string[] orderColumns, OrderDirection[] orderDirections)
        {
            ListDictionary listColAndValue = new ListDictionary();
            listColAndValue.Add(colName, colValue);
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            ormaps.GetEntitys(listColAndValue, new Operation[] { operate }, orderColumns, orderDirections);
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="colValues">实体字段名数组匹配相等的值</param>
        public T_DEMOS(string[] colNames, object[] colValues)
        {
            if (colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(listColAndValue);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="operates">比较操作符数组</param>
        /// <param name="colValues">实体字段名数组对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        public T_DEMOS(string[] colNames, Operation[] operates, object[] colValues, string[] orderColumns)
        {
            if (colNames.Length == operates.Length && colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(listColAndValue, operates, orderColumns);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="operates">比较操作符数组</param>
        /// <param name="colValues">实体字段名数组对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(string[] colNames, Operation[] operates, object[] colValues, string[] orderColumns, OrderDirection[] orderDirections)
        {
            if (colNames.Length == operates.Length && colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="listColAndValue">实体字段名及对应匹配相等的值</param>
        public T_DEMOS(ListDictionary listColAndValue)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            ormaps.GetEntitys(listColAndValue);
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="listColAndValue">实体字段名及对应匹配的值</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        public T_DEMOS(ListDictionary listColAndValue, Operation[] operates)
        {
            if (listColAndValue.Count == operates.Length)
            {
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(listColAndValue, operates);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="listColAndValue">实体字段名及对应匹配的值</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(ListDictionary listColAndValue, Operation[] operates, string[] orderColumns,OrderDirection[] orderDirections)
        {
            if (listColAndValue.Count == operates.Length)
            {
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(string[] orderColumns,OrderDirection[] orderDirections)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            ormaps.GetEntitys(new ListDictionary(), new Operation[] { }, orderColumns, orderDirections);
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="listColAndValue">实体字段名及对应匹配的值</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(DbCore dbCore, ListDictionary listColAndValue, Operation[] operates, string[] orderColumns,OrderDirection[] orderDirections)
        {
            if (listColAndValue.Count == operates.Length)
            {
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(dbCore, listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        /// <summary>
        /// T_DEMO实体集
        /// </summary>
        /// <param name="dbCore">数据库访问核心类DbCore实例(用于DbCore事务)</param>
        /// <param name="colNames">实体字段名数组</param>
        /// <param name="operates">实体字段名对应比较操作符</param>
        /// <param name="colValues">实体字段名数组对应的值</param>
        /// <param name="orderColumns">排序字段数组</param>
        /// <param name="orderDirections">对应排序方向</param>
        public T_DEMOS(DbCore dbCore, string[] colNames, Operation[] operates, object[] colValues, string[] orderColumns,OrderDirection[] orderDirections)
        {
            if (colNames.Length == operates.Length && colNames.Length == colValues.Length)
            {
                ListDictionary listColAndValue = new ListDictionary();
                for (int i = 0; i < colNames.Length; i++)
                {
                    listColAndValue.Add(colNames[i], colValues[i]);
                }
                ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
                ormaps.GetEntitys(dbCore, listColAndValue, operates, orderColumns, orderDirections);
            }
        }
        #endregion

        #region 属性方法
        /// <summary>
        /// T_DEMO集合 增加方法
        /// </summary>
        public void Add(T_DEMO entity)
        {
            this.List.Add(entity);
        }
        /// <summary>
        /// T_DEMO集合 索引
        /// </summary>
        public T_DEMO this[int index]
        {
            get { return (T_DEMO)this.List[index]; }
            set { this.List[index] = value; }
        }
        /// <summary>
        /// 将T_DEMO实体集转化到内存中一个数据表
        /// </summary>
        /// <returns>与实体集数据对等的内存中一个数据表</returns>
        public DataTable ToDataTable()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.ToDataTable();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息 比较实体前后的值(并与实体默认初始值比较确定保存哪些字段)，若有与主键记录相同的就更新，没有就插入
        /// </summary>
        /// <returns>受影响的行数</returns>
        public int Save()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.Save();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息 比较实体前后的值，若有与主键字段记录相同的就更新，没有就插入，保存全部字段
        /// </summary>
        /// <returns>受影响的行数</returns>
        public int SaveAll()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.SaveAll();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息 比较实体前后的值，若有与主键字段记录相同的就更新，没有就插入，保存全部字段
        /// 其中若与实体属性字段初始值相同则置该字段为空
        /// </summary>
        /// <returns>受影响的行数</returns>
        public int SaveEx()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.SaveEx();
        }
        /// <summary>
        /// 通过实体集中的对象信息映射及主键约束批量删除实体集对应表中的多条数据
        /// </summary>
        /// <returns>执行删除并返回受影响的行数</returns>
        public int Delete()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.Delete();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsert();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <param name="strConditionKey"></param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert(string strConditionKey)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsert(strConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 比较实体前后默认的初始值,且不插入与实体初始值相同的字段值
        /// </summary>
        /// <param name="arrConditionKey">指定作为Delete依据字段,一个或多个,可以使用对应的EntityColumn属性</param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsert(string[] arrConditionKey)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsert(arrConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsertEx();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <param name="strConditionKey"></param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx(string strConditionKey)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsertEx(strConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段,其中若与实体字段初始值相同则置该字段为空
        /// </summary>
        /// <param name="arrConditionKey">指定作为Delete依据字段,一个或多个,可以使用对应的EntityColumn属性</param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertEx(string[] arrConditionKey)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsertEx(arrConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段
        /// </summary>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertAll()
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsertAll();
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段
        /// </summary>
        /// <param name="strConditionKey"></param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertAll(string strConditionKey)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsertAll(strConditionKey);
        }
        /// <summary>
        /// 批量保存实体集中的对象信息,先Delete后Insert 插入所有字段
        /// </summary>
        /// <param name="arrConditionKey">指定作为Delete依据字段,一个或多个,可以使用对应的EntityColumn属性</param>
        /// <returns>先Delete后Insert并返回受影响的行数</returns>
        public int DelInsertAll(string[] arrConditionKey)
        {
            ORMaps<BaseEntity, T_DEMOS> ormaps = new ORMaps<BaseEntity, T_DEMOS>(new T_DEMO(), this);
            return ormaps.DelInsertAll(arrConditionKey);
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式文本信息(不含DataType属性)
        /// </summary>
        /// <returns>与持久化实体集信息相对应Xml的文本信息</returns>
        public string ToXml()
        {
            return this.ToXml(Formatting.None);
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式文本信息(不含DataType属性)
        /// </summary>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        /// <returns>与持久化实体集信息相对应Xml指定格式化后的文本信息(不含DataType属性)</returns>
        public string ToXml(Formatting xmlFormatting)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string strName = "T_DEMOS";
            sb.AppendLine("<" + strName + ">");
            foreach (T_DEMO e in this)
            {
                sb.AppendLine(e.ToXml(xmlFormatting));
            }
            sb.AppendLine("</" + strName + ">");
            return sb.ToString();
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式信息并写入到文件(不含DataType属性)
        /// </summary>
        /// <param name="filename">要写入的文件名。如果目标文件已存在，则覆盖该文件。</param>
        /// <param name="encoding">一个 System.Text.Encoding 对象，表示应用于字符串的编码。</param>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        public void ToXml(string filename, Encoding encoding, Formatting xmlFormatting)
        {
            string xmlString = this.ToXml(xmlFormatting);
            File.WriteAllText(filename, xmlString, encoding);
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式文本信息(含DataType属性)
        /// </summary>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        /// <returns>与持久化实体集信息相对应Xml指定格式化后的文本信息</returns>
        public string ToXml_(Formatting xmlFormatting)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string strName = "T_DEMOS";
            sb.AppendLine("<" + strName + ">");
            foreach (T_DEMO e in this)
            {
                sb.AppendLine(e.ToXml_(xmlFormatting));
            }
            sb.AppendLine("</" + strName + ">");
            return sb.ToString();
        }
        /// <summary>
        /// 将持久化实体集信息输出成Xml格式信息并写入到文件(含DataType属性)
        /// </summary>
        /// <param name="filename">要写入的文件名。如果目标文件已存在，则覆盖该文件。</param>
        /// <param name="encoding">一个 System.Text.Encoding 对象，表示应用于字符串的编码。</param>
        /// <param name="xmlFormatting">指定 System.Xml.XmlTextWriter 的格式设置选项</param>
        public void ToXml_(string filename, Encoding encoding, Formatting xmlFormatting)
        {
            string xmlString = this.ToXml_(xmlFormatting);
            File.WriteAllText(filename, xmlString, encoding);
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应Xml格式的文本信息实例化到该实体集
        /// </summary>
        /// <param name="xmlString"></param>
        /// <returns>实例化该实体集信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public T_DEMOS FromXml(string xmlString)
        {
            int index = 0;
            string strSubXml = string.Empty;
            while (index != -1) 
            {
                index = CommonHelp.GetSubXmlString(xmlString, "T_DEMO", index, out strSubXml);
                if (strSubXml != string.Empty)
                {
                    T_DEMO entity = new T_DEMO();
                    entity = entity.FromXml(strSubXml);
                    this.Add(entity);
                }
                else
                {
                    break;
                }
            }
            return this;
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应Xml格式的文本信息实例化到该实体集
        /// </summary>
        /// <param name="filename">要打开以进行读取的文件</param>
        /// <returns>实例化该实体集信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public T_DEMOS FromXmlFile(string filename)
        {
            string xmlString = File.ReadAllText(filename);
            return this.FromXml(xmlString);
        }
        /// <summary>
        /// 通过与持久化实体集信息相对应Xml格式的文本信息实例化到该实体集
        /// </summary>
        /// <param name="filename">要打开以进行读取的文件</param>
        /// <param name="encoding">应用到文件内容的编码。</param>
        /// <returns>实例化该实体集信息并与持久化实体信息相对应xmlString文本信息一致</returns>
        public T_DEMOS FromXmlFile(string filename, Encoding encoding)
        {
            string xmlString = File.ReadAllText(filename, encoding);
            return this.FromXml(xmlString);
        }
        #endregion
    }

	/// <summary>
	/// 实体原表描述信息:T_DEMO
	/// </summary>
	public class T_DEMOColumn
	{
        #region 公共静态只读属性
        /// <summary>
        /// 表名 表原信息描述: T_DEMO
        /// </summary>
        public static readonly string TableName="T_DEMO";
        /// <summary>
        /// 信息描述: 填写日期
        /// </summary>
        public static readonly string C_DATE="T_DEMO┋C_DATE┋System.DateTime";
        /// <summary>
        /// 信息描述: 最后修改日期时间
        /// </summary>
        public static readonly string C_EIDTDATE="T_DEMO┋C_EIDTDATE┋System.DateTime";
        /// <summary>
        /// 信息描述: 电子邮件
        /// </summary>
        public static readonly string C_EMAIL="T_DEMO┋C_EMAIL┋System.String";
        /// <summary>
        /// 信息描述: 浮点数，可正可负
        /// </summary>
        public static readonly string C_FLOAT="T_DEMO┋C_FLOAT┋System.Single";
        /// <summary>
        /// 信息描述: 正浮点数
        /// </summary>
        public static readonly string C_FLOATA="T_DEMO┋C_FLOATA┋System.Single";
        /// <summary>
        /// 信息描述: 负浮点数
        /// </summary>
        public static readonly string C_FLOATB="T_DEMO┋C_FLOATB┋System.Single";
        /// <summary>
        /// 信息描述: 序列号,格式：yyyyMMddHHmmssfff00000000
        /// </summary>
        public static readonly string C_ID="T_DEMO┋C_ID┋System.String";
        /// <summary>
        /// 信息描述: 身份证号
        /// </summary>
        public static readonly string C_IDCARD="T_DEMO┋C_IDCARD┋System.String";
        /// <summary>
        /// 信息描述: 整数，可正可负
        /// </summary>
        public static readonly string C_INT="T_DEMO┋C_INT┋System.Int32";
        /// <summary>
        /// 信息描述: 正整数
        /// </summary>
        public static readonly string C_INTA="T_DEMO┋C_INTA┋System.Int32";
        /// <summary>
        /// 信息描述: 负整数
        /// </summary>
        public static readonly string C_INTB="T_DEMO┋C_INTB┋System.Int32";
        /// <summary>
        /// 信息描述: 名称
        /// </summary>
        public static readonly string C_NAME="T_DEMO┋C_NAME┋System.String";
        /// <summary>
        /// 信息描述: 字符串
        /// </summary>
        public static readonly string C_STRING="T_DEMO┋C_STRING┋System.String";
        /// <summary>
        /// 信息描述: 字符串A
        /// </summary>
        public static readonly string C_STRINGA="T_DEMO┋C_STRINGA┋System.String";
        /// <summary>
        /// 信息描述: 字符串B
        /// </summary>
        public static readonly string C_STRINGB="T_DEMO┋C_STRINGB┋System.String";
        #endregion
	}
}
